from nodetypes import config
from nodetypes.formats.Document import Document
#from nodetypes.ntypes import Action

from myelin.json import Serializer

class Document(Document):
    
    newSerializer = Serializer
    method = 'json'
    imt = config.METHODS_TO_IMT['json']
    
    def createDocument(self, context, source):
        return self.newSerializer().serialize(
            self.createObject(
                context,
                {}
            ),
            encoding = context.preferredEncoding
        ), self.newImt(
            self.imt,
            context.preferredEncoding
        )
        
    def createObject(self, context, obj):
        obj['head'] = self.createHead(
            context,
            {}
        )
        
        obj['body'] = self.createBody(
            context,
            {}
        )        
        return obj
    
    def createHead(self, context, obj):
        return None
    
    def createBody(self, context, obj):
        return None
    

# cleanup